package com.hopkinscsc.windows;

import java.awt.*;
/**
 * An extension of the Element class for rectangles
 * @see Element
 * @author Jason
 *
 */
public class Rectangle extends Element{
	private int width, height;
	
	public Rectangle(int x, int y, int width, int height){
		super(x, y, 0, 0);
		this.width  = width;
		this.height = height;
	}
	
	/**
	 * This gets the current width value of the element
	 * @return an integer the elements width
	 */
	public int getWidth(){
		return width;
	}
	
	/**
	 * This gets the current height value of the element
	 * @return an integer the elements height
	 */
	public int getHeight(){
		return height;
	}
	
	/**
	 * This sets the elements current height
	 * @param height the value that you would like the height to be
	 */
	public void setHeight(int height){
		this.height = height;
	}
	/**
	 * This sets the elements current width
	 * @param width the value that you would like the width to be
	 */
	public void setWidth(int width){
		this.width = width;
	}
	
	void draw(Graphics g){
		g.setColor(Color.BLACK);
		if (fill())
			g.fillRect(getX(), getY(), getWidth(), getHeight());
		else
			g.drawRect(getX(), getY(), getWidth(), getHeight());
	}
}
